home *** CD-ROM | disk | FTP | other *** search
- /*
- * This file contains definitions for compiling the FreeBSD-based code
- * on a Linux system. It has been collected from misc. header files of
- * the FreeBSD distribution. Therefore the following copyright conditions
- * apply
- */
-
- /*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
- #ifndef __LINUXDEF_H__
- #define __LINUXDEF_H__
-
- #ifdef __linux
- #define NETBOOT32
- #endif
-
- #ifdef __BCC__
- #define NETBOOT16
- #define __signed__ /* cancel definition in sys/types.h */
- #endif
-
- #include <sys/types.h>
-
- typedef unsigned long Address;
-
- /* ANSI prototyping macro */
- #ifdef __STDC__
- #define P(x) x
- #else
- #define P(x) ()
- #endif
-
- #ifdef __linux
- #include <asm/byteorder.h>
- #include <asm/io.h>
- /* Linux reverses the order of the parameters, so change the macros */
- #undef outb
- #define outb(port,val) \
- ((__builtin_constant_p((port)) && (port) < 256) ? \
- __outbc((val),(port)) : \
- __outb((val),(port)))
- #undef outw
- #define outw(port,val) \
- ((__builtin_constant_p((port)) && (port) < 256) ? \
- __outwc((val),(port)) : \
- __outw((val),(port)))
- #define _edata edata /* ELF does not prepend a _ */
- #define _end end
- #endif
-
- #define IFNAMSIZ 16
- #define NGROUPS_MAX 16 /* max supplemental group id's */
- #define NGROUPS NGROUPS_MAX /* max number groups */
- #define NFSX_V2FH 32
- #define MNAMELEN 90 /* length of buffer for returned name*/
- #define MAXHOSTNAMELEN 256 /* max hostname size */
- #define SOCK_STREAM 1 /* stream socket */
- #define SOCK_DGRAM 2 /* datagram socket */
- #define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
- #define NFSMNT_WSIZE 0x00000002 /* set write size */
- #define NFSMNT_RSIZE 0x00000004 /* set read size */
- #define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
- #define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
- #define NFSERR_PERM 1
- #define NFSERR_NOENT 2
- #define NFSERR_ACCES 13
- #define AF_UNSPEC 0 /* unspecified */
- #define AF_INET 2 /* internetwork: UDP, TCP, etc. */
- #define CLSIZELOG2 0
- #define CLSIZE (1 << CLSIZELOG2)
- #define PAGE_SHIFT 12
- #define NBPG (1 << PAGE_SHIFT) /* bytes/page */
- #define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
- #define BOOTINFO_VERSION 1
- #define N_BIOS_GEOM 8
- #define NODEV (dev_t)(-1) /* non-existent device */
- #define OMAGIC 0407 /* old impure format */
- #define NMAGIC 0410 /* read-only text */
- #define ZMAGIC 0413 /* demand load format */
- #define QMAGIC 0314 /* "compact" demand load format */
- #define __LDPGSZ 4096
-
- #define N_GETMAGIC(ex) \
- ( (ex).a_midmag & 0xffff )
- #define N_GETMAGIC_NET(ex) \
- (ntohl((ex).a_midmag) & 0xffff)
- #define N_BADMAG(ex) \
- (N_GETMAGIC(ex) != OMAGIC && N_GETMAGIC(ex) != NMAGIC && \
- N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC && \
- N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \
- N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC)
- #define N_TXTOFF(ex) \
- (N_GETMAGIC(ex) == ZMAGIC ? __LDPGSZ : (N_GETMAGIC(ex) == QMAGIC || \
- N_GETMAGIC_NET(ex) == ZMAGIC) ? 0 : sizeof(struct exec))
-
- struct sockaddr {
- u_char sa_len; /* total length */
- u_char sa_family; /* address family */
- char sa_data[14]; /* actually longer; address value */
- };
-
- struct in_addr {
- u_long s_addr;
- };
-
- struct sockaddr_in {
- u_char sin_len;
- u_char sin_family;
- u_short sin_port;
- struct in_addr sin_addr;
- char sin_zero[8];
- };
-
- struct ifaliasreq {
- char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
- struct sockaddr ifra_addr;
- struct sockaddr ifra_broadaddr;
- struct sockaddr ifra_mask;
- };
-
- struct nfs_args {
- struct sockaddr *addr; /* file server address */
- int addrlen; /* length of address */
- int sotype; /* Socket type */
- int proto; /* and Protocol */
- u_char *fh; /* File handle to be mounted */
- int fhsize; /* Size, in bytes, of fh */
- int flags; /* flags */
- int wsize; /* write size in bytes */
- int rsize; /* read size in bytes */
- int readdirsize; /* readdir size in bytes */
- int timeo; /* initial timeout in .1 secs */
- int retrans; /* times to retry send */
- int maxgrouplist; /* Max. size of group list */
- int readahead; /* # of blocks to readahead */
- int leaseterm; /* Term (sec) of lease */
- int deadthresh; /* Retrans threshold */
- char *hostname; /* server's name */
- };
-
- struct ucred {
- u_short cr_ref; /* reference count */
- uid_t cr_uid; /* effective user id */
- short cr_ngroups; /* number of groups */
- gid_t cr_groups[NGROUPS]; /* groups */
- };
-
- struct nfs_diskless {
- struct ifaliasreq myif; /* Default interface */
- struct sockaddr_in mygateway; /* Default gateway */
- struct nfs_args swap_args; /* Mount args for swap file */
- u_char swap_fh[NFSX_V2FH]; /* Swap file's file handle */
- struct sockaddr_in swap_saddr; /* Address of swap server */
- char swap_hostnam[MNAMELEN]; /* Host name for mount pt */
- int swap_nblks; /* Size of server swap file */
- struct ucred swap_ucred; /* Swap credentials */
- struct nfs_args root_args; /* Mount args for root fs */
- u_char root_fh[NFSX_V2FH]; /* File handle of root dir */
- struct sockaddr_in root_saddr; /* Address of root server */
- char root_hostnam[MNAMELEN]; /* Host name for mount pt */
- long root_time; /* Timestamp of root fs */
- char my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
- };
-
- struct bootinfo {
- unsigned int bi_version;
- unsigned char *bi_kernelname;
- struct nfs_diskless *bi_nfs_diskless;
- /* End of fields that are always present. */
- #define bi_endcommon bi_n_bios_used
- unsigned int bi_n_bios_used;
- unsigned long bi_bios_geom[N_BIOS_GEOM];
- unsigned int bi_size;
- unsigned char bi_memsizes_valid;
- unsigned char bi_pad[3];
- unsigned long bi_basemem;
- unsigned long bi_extmem;
- unsigned long bi_symtab;
- unsigned long bi_esymtab;
- };
-
- struct exec {
- unsigned long a_midmag; /* flags<<26 | mid<<16 | magic */
- unsigned long a_text; /* text segment size */
- unsigned long a_data; /* initialized data size */
- unsigned long a_bss; /* uninitialized data size */
- unsigned long a_syms; /* symbol table size */
- unsigned long a_entry; /* entry point */
- unsigned long a_trsize; /* text relocation size */
- unsigned long a_drsize; /* data relocation size */
- };
-
- #endif
-